<template>
  <div
    class="e-content"
    v-loading="loading"
    element-loading-text="加载中..."
    element-loading-spinner="el-icon-loading"
    v-bind="$attrs"
  >
    <div class="content-title" v-if="title || $slots['title'] || $slots['title-right']">
      <div class="title-text">
        <slot name="title">
          {{ title }}
        </slot>
      </div>
      <div class="title-right">
        <slot name="title-right"></slot>
      </div>
    </div>
    <div class="content-body">
      <slot></slot>
    </div>
  </div>
</template>
<script setup lang="ts" name="EContent">
  defineProps({
    title: {
      type: String,
      default: ''
    },
    loading: {
      type: Boolean,
      default: false
    }
  })
</script>
<style scoped lang="scss">
  .e-content {
    background: #ffffff;
    .content-title {
      height: 56px;
      line-height: 56px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: #ffffff;
      padding: 0 20px;
      .title-text {
        font-family: PingFang SC;
        font-size: 20px;
        font-weight: 600;
        line-height: 28px;
        text-align: left;
      }
    }
    .content-body {
      padding: 20px;
    }
  }
</style>
